<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@page import="portal.vo.*" %>
<%@page import="java.util.*" %>
<script type="text/javascript" src="scripts/ajax.js"></script>
<script>

function detalleCompras(selurl) {

    var left       = 50;
    var top        = 50;
    var height     = 500;
    var width      = 800;
    var scrollbars = 'yes';
  
    selector = window.open (selurl, "Selector", "toolbar=no,directories=no,scrollbars=" + scrollbars + ",menubar=yes,status=yes,resizable=no,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top);  
    }



</script>

<%
List<CompraVO> compras = new ArrayList<CompraVO>();
if(session.getAttribute("listaCompras") != null)
	compras = (List<CompraVO>)session.getAttribute("listaCompras");
%>

<form>
<a name="inicio"></a>

<div style="width: 100%; height: 100%; overflow:scroll">
<table class="listaResultadoContenedor" cellSpacing=1 cellPadding=3 align="center" border=0>
	<tbody>
		<tr>
			<td class=titulotabla align="center" width="25%">Compra</td>
			<td class=titulotabla align="center" width="25%">Fecha</td>
			<td class=titulotabla align="center" width="25%">Estado</td>
			<td class=titulotabla align="center" width="25%">&nbsp;</td>
			
		</tr>
		<%int i = 0; %>
		<%for(CompraVO c: compras) { %>
		<% i++; %>
		 <%
              if ((i % 2) == 0) {
                out.println("<TR align=\"center\" class=\"odd\">");
              } else {
                out.println("<TR align=\"center\" class=\"even\">");
              }
            %>
			<td class=azul align="center"><%= i %></td>
			<td class=azul align="center"><%= c.getFechaCompraString() %></td>
			<td class=azul align="center"><%= c.getEstadoCompra() %></td>
			
			<td class=azul align="center"><a href="#" onclick="javascript:detalleCompras('/PortalWeb/ObtenerDetalleCompraServlet?id=<%= c.getId() %>')">Ver detalle</a></td>
		<%
              out.println("</TR>");
            %>
		<%} %>
	 	<tr bgColor=#cccccc>
	  	    <TD>&nbsp;</TD>
	        <TD>&nbsp;</TD>	      
	  	    <TD>&nbsp;</TD>
	  	    <TD>&nbsp;</TD>
        </tr>

	</tbody>
</table>
</div>


</form>